<template>
    <div>
        <el-container style="height: 721px; border: 1px solid #eee">
            <el-aside width="200px" style="background-color: #545c64">
                <el-row class="tac">
                    <el-col>
                        <el-menu
                        default-active="2"
                        class="el-menu-vertical-demo"
                        background-color="#545c64"
                        text-color="#fff"
                        active-text-color="#ffd04b">
                        <el-submenu index="1" v-if="this.$cookies.get('product_first') == 'ok'">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>商品</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/allshop')" v-if="this.$cookies.get('allshop_second') == 'ok'">商品列表</el-menu-item>
                                <el-menu-item @click="onClick('/checkshop')" v-if="this.$cookies.get('checkshop_second') == 'ok'">商品审核</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="2" v-if="this.$cookies.get('promotion_first') == 'ok'">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>促销</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/coupon_backstage')" v-if="this.$cookies.get('coupon_second') == 'ok'">优惠券审核</el-menu-item>
                                <el-menu-item @click="onClick('/seckill_backstage')" v-if="this.$cookies.get('seckill_second') == 'ok'">秒杀活动审核</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="3" v-if="this.$cookies.get('shop_first') == 'ok'">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>店铺</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/shopcheck')" v-if="this.$cookies.get('shopcheck_second') == 'ok'">审核店铺申请</el-menu-item>
                                <el-menu-item @click="onClick('/shopupdate')" v-if="this.$cookies.get('shopupdate_second') == 'ok'">查看所有商家信息</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="4" v-if="this.$cookies.get('census_first') == 'ok'">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>统计</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/topsell')" v-if="this.$cookies.get('topsell_second') == 'ok'">热销商品</el-menu-item>
                                <el-menu-item @click="onClick('/payrefund')" v-if="this.$cookies.get('payrefund_second') == 'ok'">下单/退款的订单数量</el-menu-item>
                                <el-menu-item @click="onClick('/topproduct')" v-if="this.$cookies.get('topproduct_second') == 'ok'">首页热门商品</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        <el-submenu index="5" v-if="this.$cookies.get('backstage_first') == 'ok'">
                            <template slot="title">
                                <i class="el-icon-location"></i>
                                <span>后台</span>
                            </template>
                            <el-menu-item-group>
                                <el-menu-item @click="onClick('/user')" v-if="this.$cookies.get('user_second') == 'ok'">用户/商家/管理员管理</el-menu-item>
                                <el-menu-item @click="onClick('/role')" v-if="this.$cookies.get('role_second') == 'ok'">角色权限管理</el-menu-item>
                                <el-menu-item @click="onClick('/order_backstage')" v-if="this.$cookies.get('order_second') == 'ok'">订单管理</el-menu-item>
                                <el-menu-item @click="onClick('/refund')" v-if="this.$cookies.get('refund_second') == 'ok'">退款管理</el-menu-item>
                            </el-menu-item-group>
                        </el-submenu>
                        </el-menu>
                    </el-col>
                </el-row>
            </el-aside>
        
            <el-container>
                <el-header style="text-align: right; font-size: 12px">
                    <span style="font-size:15px">{{this.$cookies.get("adminname")}}</span>
                    <el-dropdown style="padding-left:20px">
                        <i class="el-icon-setting" style="margin-right: 15px;font-size:20px"></i>
                        <el-dropdown-menu slot="dropdown">
                            <el-dropdown-item><a @click="outlogin">退出</a></el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </el-header>
                
                <el-main>
                    <router-view/>
                </el-main>
            </el-container>
        </el-container>
    </div>
</template>

<script>
export default {
    name: "shoppage",
    methods: {
      outlogin() {
        this.$cookies.remove("adminname");
        this.$cookies.remove("product_first");
        this.$cookies.remove("promotion_first");
        this.$cookies.remove("shop_first");
        this.$cookies.remove("census_first");
        this.$cookies.remove("backstage_first");
        this.$cookies.remove("allshop_second");
        this.$cookies.remove("checkshop_second");
        this.$cookies.remove("coupon_second")
        this.$cookies.remove("seckill_second");
        this.$cookies.remove("shopcheck_second");
        this.$cookies.remove("shopupdate_second");
        this.$cookies.remove("topsell_second");
        this.$cookies.remove("payrefund_second");
        this.$cookies.remove("topproduct_second");
        this.$cookies.remove("user_second");
        this.$cookies.remove("role_second");
        this.$cookies.remove("order_second");
        this.$cookies.remove("refund_second");
        this.$router.go(0)
      },
      onClick(url){
          this.$router.push(url)
      }
    }
}
</script>

<style scoped>
  .el-header {
    background-color: #B3C0D1;
    color: #333;
    line-height: 60px;
  }
  
  .el-aside {
    color: #333;
  }
</style>